package com.dcy.znoa.common.enums;

/**
 * Created by pengyu on 2017/10/6.
 */
public enum OperTypeCode {//1：平台管理员；2：企业管理员；3：企业用户;4：园区管理员；5：物业管理员；6：物业普通员工
    //1：平台管理员；2：企业管理员；3：企业用户
    SYS(1, "平台管理员"),
    COPER(2, "企业管理员"),
    CUSER(3, "企业用户"),
    PARKMGR(4, "园区管理员"),
    PLACEMGR(5, "物业管理员"),
    PLACECOM(6, "物业普通员工");

    private Integer code;
    private String msg;

    private OperTypeCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static  String getMsgByCode(Integer code) {
        if(code==null){return null;}
        switch (code.intValue()) {
            case 1:
                return SYS.getMsg();
            case 2:
                return COPER.getMsg();
            case 3:
                return CUSER.getMsg();
            case 4:
                return PARKMGR.getMsg();
            case 5:
                return PLACEMGR.getMsg();
            case 6:
                return PLACECOM.getMsg();
            default:
                return null;
        }
    }

    public static  OperTypeCode getByCode(Integer code) {
        if(code==null){return null;}
        switch (code.intValue()) {
            case 1:
                return SYS;
            case 2:
                return COPER;
            case 3:
                return CUSER;
            case 4:
                return PARKMGR;
            case 5:
                return PLACEMGR;
            case 6:
                return PLACECOM;
            default:
                return null;
        }
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static  void main(String args[]){
        System.out.println(getMsgByCode(2));

    }

}

